<?php
class ControllerInformationInformation extends Controller {
	public function index() {
		$this->load->language('information/information');

		$this->load->model('catalog/information');

		$data['breadcrumbs'] = array();

		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('text_home'),
			'href' => $this->url->link('common/home')
		);

		if (isset($this->request->get['information_id'])) {
			$information_id = (int)$this->request->get['information_id'];
		} else {
			$information_id = 0;
		}

		$information_info = $this->model_catalog_information->getInformation($information_id);

		if ($information_info) {
			$this->document->setTitle($information_info['meta_title']);
			$this->document->setDescription($information_info['meta_description']);
			$this->document->setKeywords($information_info['meta_keyword']);
			$this->document->addSeoMeta('<meta name="robots" content="index, follow"/>'."\n");

			$data['breadcrumbs'][] = array(
				'text' => $information_info['title'],
				'href' => $this->url->link('information/information', 'information_id=' .  $information_id)
			);

			$data['heading_title'] = $information_info['title'];

			$data['description'] = html_entity_decode($information_info['description'], ENT_QUOTES, 'UTF-8');

			$data['continue'] = $this->url->link('common/home');

			$data['column_left'] = $this->load->controller('common/column_left');
			$data['column_right'] = $this->load->controller('common/column_right');
			$data['content_top'] = $this->load->controller('common/content_top');
			$data['content_bottom'] = $this->load->controller('common/content_bottom');
			$data['footer'] = $this->load->controller('common/footer');
			$data['header'] = $this->load->controller('common/header');

            //微数据
            switch ($information_id) {
                case 3:
                    $json = array();
                    $json['@context'] = 'https://schema.org';
                    $json['@type'] = 'PrivacyPolicy';
                    $json['name'] = 'Privacy Policy - IrugbyStore';
                    $json['description'] = 'Learn more about IrugbyStore, your trusted source for rugby gear, jerseys, and more.';
                    $json['url'] = 'https://www.irugbystore.com/privacy';
                    $json['publisher'] = array(
                        '@type' => 'Organization',
                        'name' => 'IrugbyStore',
                        'url' => 'https://www.irugbystore.com/',
                        'logo' => array(
                            '@type' => "ImageObject",
                            'url' => "https://www.irugbystore.com/image/catalog/irugbystore-logo.png",
                            'width' => 88,
                            'height' => 88
                        )
                    );
                    $json['inLanguage'] = $this->session->data['language'] ?? 'en-gb';
                    $json['mainEntity'] = array(
                        '@type' => 'WebPage',
                        'name' => 'Privacy Policy',
                        'url' => 'https://www.irugbystore.com/privacy'
                    );
                    $json['dateModified'] = "2025-06-2";

                    $data['structured_data'] = '<script type="application/ld+json">'.json_encode($json).'</script>'."\n";
                    break;
                case 4:
                    $json = array();
                    $json['@context'] = 'https://schema.org';
                    $json['@type'] = 'AboutPage';
                    $json['description'] = 'Learn more about IrugbyStore, your trusted source for rugby gear, jerseys, and more.';
                    $json['mainEntity'] = array(
                        '@type' => 'Organization',
                        'name' => 'IrugbyStore',
                        'url' => 'https://www.irugbystore.com/',
                        'logo' => array(
                            '@type' => "ImageObject",
                            'url' => "https://www.irugbystore.com/image/catalog/irugbystore-logo.png",
                            'width' => 88,
                            'height' => 88
                        ),
                        'sameAs' => array()
                    );

                    $data['structured_data'] = '<script type="application/ld+json">'.json_encode($json).'</script>'."\n";
                    break;
                case 6:
                    $json = array();
                    $json['@context'] = 'https://schema.org';
                    $json['@type'] = 'FAQPage';
                    $json['mainEntity'] = array(
                        array(
                            '@type' => 'Question',
                            'name' => 'How can I track my order?',
                            'acceptedAnswer' => array(
                                '@type' => "Answer",
                                'text' => "Once your order has been dispatched, you will receive an email with tracking details. Simply click the tracking link to follow your order status. You will need your Order ID or the email address used during purchase.",
                            ),
                        ),
                        array(
                            '@type' => 'Question',
                            'name' => 'How long will it take to receive my order?',
                            'acceptedAnswer' => array(
                                '@type' => "Answer",
                                'text' => "We strive to pick and pack your order within 24 hours. You will get an email confirmation once your order ships. Please note that delays may happen during Christmas, Easter, public holidays, or due to local transport schedules in remote areas.",
                            ),
                        ),
                        array(
                            '@type' => 'Question',
                            'name' => 'Can I have my order delivered to a different address?',
                            'acceptedAnswer' => array(
                                '@type' => "Answer",
                                'text' => "Yes, you can enter an alternative delivery address during the checkout process.",
                            ),
                        ),
                        array(
                            '@type' => 'Question',
                            'name' => 'How can I send items to different addresses?',
                            'acceptedAnswer' => array(
                                '@type' => "Answer",
                                'text' => "You will need to place separate orders for each delivery address.",
                            ),
                        ),
                        array(
                            '@type' => 'Question',
                            'name' => 'What if my order has not arrived within the estimated timeframe?',
                            'acceptedAnswer' => array(
                                '@type' => "Answer",
                                'text' => "If your order hasn’t arrived within the estimated delivery timeframe or you have further questions, please contact our customer service team for assistance.",
                            ),
                        )
                    );

                    $data['structured_data'] = '<script type="application/ld+json">'.json_encode($json).'</script>'."\n";

                    $json = array();
                    $json['@context'] = 'https://schema.org';
                    $json['@type'] = 'WebPage';
                    $json['name'] = 'Delivery Information - IrugbyStore';
                    $json['description'] = 'IrugbyStore – Your Ultimate World Rugby Online Store Complete team jerseys, limited-time discounts, top-quality products, authentic replicas, and fast shipping.';
                    $json['url'] = 'https://www.irugbystore.com/delivery';

                    $data['structured_data'] .= '<script type="application/ld+json">'.json_encode($json).'</script>'."\n";
                    break;
            }

			$this->response->setOutput($this->load->view('information/information', $data));
		} else {
			$data['breadcrumbs'][] = array(
				'text' => $this->language->get('text_error'),
				'href' => $this->url->link('information/information', 'information_id=' . $information_id)
			);

			$this->document->setTitle($this->language->get('text_error'));

			$data['heading_title'] = $this->language->get('text_error');

			$data['text_error'] = $this->language->get('text_error');

			$data['continue'] = $this->url->link('common/home');

			$this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found');

			$data['column_left'] = $this->load->controller('common/column_left');
			$data['column_right'] = $this->load->controller('common/column_right');
			$data['content_top'] = $this->load->controller('common/content_top');
			$data['content_bottom'] = $this->load->controller('common/content_bottom');
			$data['footer'] = $this->load->controller('common/footer');
			$data['header'] = $this->load->controller('common/header');

			$this->response->setOutput($this->load->view('error/not_found', $data));
		}
	}

	public function agree() {
		$this->load->model('catalog/information');

		if (isset($this->request->get['information_id'])) {
			$information_id = (int)$this->request->get['information_id'];
		} else {
			$information_id = 0;
		}

		$output = '';

		$information_info = $this->model_catalog_information->getInformation($information_id);

		if ($information_info) {
			$output .= html_entity_decode($information_info['description'], ENT_QUOTES, 'UTF-8') . "\n";
		}

		$this->response->setOutput($output);
	}
}
